<div id="top-panel">
    <div id="panel">
        <ul>
            <li><a href="<?php echo site_url("fund/create"); ?>" class="report">Create</a></li>           
        </ul>
    </div>
</div>
<script language="javascript">
	var jq = jQuery.noConflict();
	jq(document).ready(function(){
		jq("#kiosk").change(function(){
			var val = jq(this).val();
			if( val !=0 ){
				var url = jq("#myform").attr("action");
				document.location=url+"/"+val;
			}
			else{
				window.location = jq('a.hidden-link').attr('href');
			}
		});	
	});
</script>
<div id="wrapper">
	<div id="content">
		<div id="rightnow">
			<h3 class="reallynow">Fund list</h3>
			<div style="margin: 5px;">
				<span>Filter by: </span><select name="" id="kiosk" class="input1">
					<option value="0">--Select KIOSK--</option>
					<?php foreach($kiosk as $v): ?>					
						<option value="<?php echo $v['id']; ?>" <?php if(isset($kid) && $kid==$v['id']):?> selected="selected" <?php endif;?>><?php echo $v['mac_address']; ?></option>
					<?php endforeach; ?>
				</select>
			</div>
			<?php if (isset($fund) && count($fund)): ?>
			<table width="100%">
				<thead>
					<tr>
						<th>KIOSK</th>
						<th>Donate</th>
						<th>Date</th>					
						<th>Task</th>					
					</tr>
				</thead>
				<tbody>
					<?php foreach($fund as $v): ?>
					<tr>
						<td><div align="center"><?php echo $v['mac_address']; ?></div></td>
						<td><div align="center"><?php echo $v['donate']; ?></div></td>
						<td><div align="center"><?php echo $v['date']; ?></div></td>
						<td><div align="center"><a class="tool" href="<?php echo site_url("fund/delete/".$v['id']); ?>">Delete</a></div></td>
					</tr>
					<?php endforeach; ?>
					<?php if(isset($total_donate)): ?>
					<tr>
						<td><div align="center"><strong>Total:</strong></div></td>
						<td><div align="center"><strong><?php echo $total_donate; ?></strong></div></td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
					</tr>
					<?php endif; ?>
				</tbody>
			</table>
			<div id="pager">
				<?php echo $this->pagination->create_links(); ?>
			</div>
			<?php else: ?>
				<p>No data to display</p>
			<?php endif; ?>
			<?php 
					$attributes = array('id' => 'myform'); 
					echo form_open('fund/filter/', $attributes);
			?>
			<a href="<?php echo site_url('fund'); ?>" class="hidden-link" style="display:none;"></a>
		</div>
	</div>
</div>